import React, { useEffect } from 'react';
import TextChatDialog from '../../../components/textChatDialog/TextChatDialog';
import useArxivState from "../models/arxivState";
import config from "../../../config/config";

const ArxivPage = (props) => {

    const {
        loading, setLoading,
        textChatMessages, setTextChatMessages,
        documentList, setDocumentList,
        selectedDocument, setSelectedDocument,
        focusBlurFlag, setFocusBlurFlag,
        completeStatus, setCompleteStatus,
        selectedPattern, setSelectedPattern,
        workflowGraph, onSendChat,
        loadWorkflowGraph
    } = useArxivState();

    useEffect(() => {
        loadWorkflowGraph();
    }, []);

    const textChatDialogProps = {
        loading,
        libraryVisible: false,
        pageSource: "arxiv",
        textChatMessages,
        setTextChatMessages,
        selectedPattern,
        focusBlurFlag,
        completeStatus,
        patternOptions: null,
        documentOptions: null,
        workflowGraph,
        selectDocument: setSelectedDocument,
        selectPattern: setSelectedPattern,
        focusBlurTextArea: setFocusBlurFlag,
        onSendChat: (values, query) => onSendChat(values, query)
    }

    return (
        <div style={{ width: "100%", height: "100%" }}>
            <TextChatDialog { ...textChatDialogProps } />
        </div>
    );
}

export default ArxivPage;
